﻿

// gets data for each question and sets the right input element input type template and set its attributes
var formElementsFactory = function ($http, $q) {
    var factory = {};
    var webApiUrl = 'http://localhost:55405/api/FormQuestions';
    factory.getFormElementsData = function () {
        var deferred = $q.defer();
        $http.get(webApiUrl, { cache: true })
                     .success(function (formElements) {
                         deferred.resolve(formElements);
                     }).error(function (error) {
                         deferred.reject(error);
                     });
        return deferred.promise;
    };
    return factory;
};
